import axios from 'axios'

const service = axios.create({
	baseURL: ''
})

service.interceptors.request.use(config => {
	config.headers = config.headers || {}
	
	config.headers['Content-Type'] = config.headers['Content-Type'] || 'application/json;charset=utf-8'
	
	return config
}, error => {
	console.log(error)
})

service.interceptors.response.use(res => {
		const response = res?.data || {}
		return Promise.resolve(response)
	},
	error => {
		return Promise.reject(error);
	}
)

export default service
